<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.1.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.14.0/css/all.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css">

<script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"foryoungyu.gitee.io","root":"/","scheme":"Gemini","version":"8.0.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"}};
  </script>

  <meta name="description" content="欣欣向荣">
<meta property="og:type" content="website">
<meta property="og:title" content="Salt.&#39;s Blog">
<meta property="og:url" content="https://foryoungyu.gitee.io/index.html">
<meta property="og:site_name" content="Salt.&#39;s Blog">
<meta property="og:description" content="欣欣向荣">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="Foryoung Yu">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="https://foryoungyu.gitee.io/">


<script class="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : true,
    isPost : false,
    lang   : 'zh-CN'
  };
</script>

  <title>Salt.'s Blog</title>
  






  <noscript>
  <style>
  body { margin-top: 2rem; }

  .use-motion .menu-item,
  .use-motion .sidebar,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header {
    visibility: visible;
  }

  .use-motion .header,
  .use-motion .site-brand-container .toggle,
  .use-motion .footer { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle,
  .use-motion .custom-logo-image {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line {
    transform: scaleX(1);
  }

  .search-pop-overlay, .sidebar-nav { display: none; }
  .sidebar-panel { display: block; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">Salt.'s Blog</h1>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">生于忧患，死于安乐</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-系列">

    <a href="/series/" rel="section"><i class="fa fa-book fa-fw"></i>系列</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-schedule">

    <a href="/schedule/" rel="section"><i class="fa fa-calendar fa-fw"></i>日程表</a>

  </li>
  </ul>
</nav>




</div>
        
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-overview-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <section class="post-toc-wrap sidebar-panel">
      </section>
      <!--/noindex-->

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Foryoung Yu"
      src="/images/dog.jpg">
  <p class="site-author-name" itemprop="name">Foryoung Yu</p>
  <div class="site-description" itemprop="description">欣欣向荣</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">9</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">6</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">11</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/ForyoungYu" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;ForyoungYu" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:foryoung@outlook.com" title="E-Mail → mailto:foryoung@outlook.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://weibo.com/u/5935274514" title="Weibo → https:&#x2F;&#x2F;weibo.com&#x2F;u&#x2F;5935274514" rel="noopener" target="_blank"><i class="fab fa-weibo fa-fw"></i>Weibo</a>
      </span>
  </div>



      </section>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner index posts-expand">
      

      
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://foryoungyu.gitee.io/2021/02/13/%E3%80%90%E6%95%B0%E6%8D%AE%E5%BA%93%E3%80%91Mysql%E5%88%9D%E6%AC%A1%E5%AE%89%E8%A3%85%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/dog.jpg">
      <meta itemprop="name" content="Foryoung Yu">
      <meta itemprop="description" content="欣欣向荣">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Salt.'s Blog">
    </span>

    
    
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/02/13/%E3%80%90%E6%95%B0%E6%8D%AE%E5%BA%93%E3%80%91Mysql%E5%88%9D%E6%AC%A1%E5%AE%89%E8%A3%85%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98/" class="post-title-link" itemprop="url">【数据库】MySQL初次安装常见问题</a>
        </h2>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-02-13 00:00:00" itemprop="dateCreated datePublished" datetime="2021-02-13T00:00:00+08:00">2021-02-13</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-14 11:36:52" itemprop="dateModified" datetime="2021-02-14T11:36:52+08:00">2021-02-14</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/" itemprop="url" rel="index"><span itemprop="name">数据库</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
          <h1 id="MySQL初次安装常见问题"><a href="#MySQL初次安装常见问题" class="headerlink" title="MySQL初次安装常见问题"></a>MySQL初次安装常见问题</h1><h2 id="Failed-to-find-valid-data-directory"><a href="#Failed-to-find-valid-data-directory" class="headerlink" title="Failed to find valid data directory."></a>Failed to find valid data directory.</h2><p>Linux 安装Mysql或者Mariadb后，想要开启数据库服务，一般会打开服务失败。</p>
<p>输入<code>systemctl status mysqld.service</code>之后输出入下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line">● mysqld.service - MySQL Server</span><br><span class="line">     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)</span><br><span class="line">     Active: failed (Result: exit-code) since Sat 2021-02-13 20:53:24 CST; 19min ago</span><br><span class="line">       Docs: man:mysqld(8)</span><br><span class="line">             http://dev.mysql.com/doc/refman/en/using-systemd.html</span><br><span class="line">    Process: 422056 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)</span><br><span class="line">    Process: 422124 ExecStart=/usr/bin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)</span><br><span class="line">   Main PID: 422124 (code=exited, status=1/FAILURE)</span><br><span class="line">     Status: &quot;Server startup in progress&quot;</span><br><span class="line">      Error: 2 (没有那个文件或目录)</span><br><span class="line"></span><br><span class="line">2月 13 20:53:23 arch mysqld_pre_systemd[422082]: 2021-02-13T12:53:23.566434Z 0 [System] [MY-010910] [Server] /usr/bin/mysqld: Shutdown complete (mysqld 8.0.23)  Source distribution.</span><br><span class="line">2月 13 20:53:24 arch mysqld[422124]: 2021-02-13T12:53:24.367415Z 0 [Warning] [MY-010915] [Server] &#x27;NO_ZERO_DATE&#x27;, &#x27;NO_ZERO_IN_DATE&#x27; and &#x27;ERROR_FOR_DIVISION_BY_ZERO&#x27; sql modes should be used with strict mode. They will be merged with strict mode in a future release.</span><br><span class="line">2月 13 20:53:24 arch mysqld[422124]: 2021-02-13T12:53:24.367480Z 0 [System] [MY-010116] [Server] /usr/bin/mysqld (mysqld 8.0.23) starting as process 422124</span><br><span class="line">2月 13 20:53:24 arch mysqld[422124]: 2021-02-13T12:53:24.454185Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.</span><br><span class="line">2月 13 20:53:24 arch mysqld[422124]: 2021-02-13T12:53:24.454521Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.</span><br><span class="line">2月 13 20:53:24 arch mysqld[422124]: 2021-02-13T12:53:24.454706Z 0 [ERROR] [MY-010119] [Server] Aborting</span><br><span class="line">2月 13 20:53:24 arch mysqld[422124]: 2021-02-13T12:53:24.455860Z 0 [System] [MY-010910] [Server] /usr/bin/mysqld: Shutdown complete (mysqld 8.0.23)  Source distribution.</span><br><span class="line">2月 13 20:53:24 arch systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE</span><br><span class="line">2月 13 20:53:24 arch systemd[1]: mysqld.service: Failed with result &#x27;exit-code&#x27;.</span><br><span class="line">2月 13 20:53:24 arch systemd[1]: Failed to start MySQL Server.</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>发现第一个ERROR的错误是<code>Failed to find valid data directory.</code>。经过查阅资料发现，说的就是初始化Data文件夹失败了。而这个Data文件夹指的就是/etc/my.cnf下面配置的datadir路径。</p>
<p><strong>my.cnf</strong> 如果不在/etc目录下，可在/etc/mysql目录下复制一份到/etc目录下。</p>
<p>在my.cnf文件中有这么一项参数：datadir=/var/lib/mysql </p>
<p>移动到/var/lib目录下将mysql目录删除掉：<code>rm -rf /var/lib/mysql</code></p>
<p>之后重新初始化：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> mysqld --initialize --console</span></span><br><span class="line"><span class="meta">$</span><span class="bash"> chown -R mysql:mysql /var/lib/mysql/</span></span><br></pre></td></tr></table></figure>

<p>执行完成之后自动生成一串root密码，记住他。</p>
<p>之后就可以正常启动mysql了</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> systemctl start mysqld</span></span><br><span class="line"><span class="meta">$</span><span class="bash"> systemctl <span class="built_in">enable</span> mysqld</span></span><br></pre></td></tr></table></figure>

<p>重设mysql的root密码，执行<code>mysql_secure_installation</code>输入刚刚生成的root密码。</p>
<p>之后根据需要选择y或n即可。</p>
<h2 id="ER-NOT-SUPPORTED-AUTH-MODE-Client-does-not-support-authentication-protocol-requested-by-server"><a href="#ER-NOT-SUPPORTED-AUTH-MODE-Client-does-not-support-authentication-protocol-requested-by-server" class="headerlink" title="ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server"></a>ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server</h2><p>导致这个错误的原因是，目前，最新的mysql模块并未完全支持MySQL 8的“caching_sha2_password”加密方式，而“caching_sha2_password”在MySQL 8中是默认的加密方式。因此，下面的方式命令是默认已经使用了“caching_sha2_password”加密方式，该账号、密码无法在mysql模块中使用。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">mysql&gt;</span><span class="bash"> ALTER USER <span class="string">&#x27;root&#x27;</span>@<span class="string">&#x27;localhost&#x27;</span> IDENTIFIED BY <span class="string">&#x27;123456&#x27;</span>;</span></span><br><span class="line">Query OK, 0 rows affected (0.12 sec)</span><br></pre></td></tr></table></figure>

<p><strong>解决方法</strong></p>
<p>解决方法是从新修改用户root的密码，并指定mysql模块能够支持的加密方式：</p>
<figure class="highlight plain"><figcaption><span>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Query OK, 0 rows affected (0.12 sec)</span><br></pre></td></tr></table></figure>
<p>上述语句，显示指定了使用“mysql_native_password”的加密方式。这种方式是在mysql模块能够支持。</p>
<blockquote>
<p>参考文献：</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/liurui50/article/details/105478422">CentOS7 MySQL8.0 启动失败 Data Dictionary initialization failed</a></p>
</blockquote>

      
    </div>

    
    
    

    <footer class="post-footer">
        <div class="post-eof"></div>
      
    </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://foryoungyu.gitee.io/2021/01/10/%E3%80%90LaTex%E3%80%91LaTex%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/dog.jpg">
      <meta itemprop="name" content="Foryoung Yu">
      <meta itemprop="description" content="欣欣向荣">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Salt.'s Blog">
    </span>

    
    
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/01/10/%E3%80%90LaTex%E3%80%91LaTex%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/" class="post-title-link" itemprop="url">【LaTex】LaTex的安装和基本使用</a>
        </h2>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-01-10 18:36:29" itemprop="dateCreated datePublished" datetime="2021-01-10T18:36:29+08:00">2021-01-10</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-13 22:18:58" itemprop="dateModified" datetime="2021-02-13T22:18:58+08:00">2021-02-13</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/Latex/" itemprop="url" rel="index"><span itemprop="name">Latex</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
          
      
    </div>

    
    
    

    <footer class="post-footer">
        <div class="post-eof"></div>
      
    </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://foryoungyu.gitee.io/2021/01/10/%E3%80%90%E6%95%B0%E6%8D%AE%E5%BA%93%E3%80%91MariaDB%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/dog.jpg">
      <meta itemprop="name" content="Foryoung Yu">
      <meta itemprop="description" content="欣欣向荣">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Salt.'s Blog">
    </span>

    
    
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/01/10/%E3%80%90%E6%95%B0%E6%8D%AE%E5%BA%93%E3%80%91MariaDB%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/" class="post-title-link" itemprop="url">【数据库】MariaDB数据库的安装和基本使用</a>
        </h2>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-01-10 18:33:14" itemprop="dateCreated datePublished" datetime="2021-01-10T18:33:14+08:00">2021-01-10</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-13 22:18:58" itemprop="dateModified" datetime="2021-02-13T22:18:58+08:00">2021-02-13</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/" itemprop="url" rel="index"><span itemprop="name">数据库</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
          <h2 id="MariaDB是什么"><a href="#MariaDB是什么" class="headerlink" title="MariaDB是什么"></a>MariaDB是什么</h2><p>数据库是指按照某些特定结构来存储数据资料的数据仓库。在当今这个大数据迅速崛起的时代，互联网上每天都会产生海量的信息数据，数据库技术也从最初的只能存储简单的表格数据的单一集中存储模式，发展到了现如今存储海量数据的大型分布式模式。</p>
<p>数据库管理系统（DMS）是一种能够对数据库中存放的数据进行建立、修改、删除、查找、维护等有效操作的软件程序。那么，既然是讲解数据库管理技术，肯定绕不开MySQL。MySQL是一款市场占有率非常高的数据库管理系统，技术成熟、配置步骤相对简单，而且具有良好的可扩展性。但是，由于Oracle公司在2009年收购了MySQL的母公司Sun，因此MySQL数据库项目也随之纳入Oracle麾下，逐步演变为保持着开源软件的身份，但又申请了多项商业专利的软件系统。开源软件是全球黑客、极客、程序员等技术高手在开源社区的大旗下的公共智慧结晶，自己的劳动成果被其他公司商业化自然伤了一大批开源工作者的心，因此MySQL项目创始者重新研发了一款名为MariaDB的全新数据库管理系统。该软件当前由开源社区进行维护，是MySQL的分支产品，而且几乎完全兼容MySQL。</p>
<p>与此同时，由于各大公司之间存在着竞争关系或利益关系，外加MySQL在被收购后逐渐由开源向闭源转变，很多公司抛弃了MySQL，转而使用MariaDB。</p>
<h2 id="MariaDB的安装"><a href="#MariaDB的安装" class="headerlink" title="MariaDB的安装"></a>MariaDB的安装</h2><p>我们这里使用Ubuntu系统来安装MariaDB。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install mariadb-server mariadb-client</span><br></pre></td></tr></table></figure>

<p>在确认安装好以后，请不要立即使用。为了保证数据库的安全性和正常运转，需要先对数据库进行初始化操作。这个初始化包含一下五个步骤。</p>
<ul>
<li>设置root管理员在数据库中的密码值（注意，该密码值并非root管理员在系统中的密码，这里的密码值应该设置为空，<strong>可以直接按回车键</strong>）。</li>
<li>设置root管理员在数据库中的专有密码。</li>
<li>随后删除匿名账户，并使用root管理员从远程登录数据库，以保证数据库上运行的业务的安全性。</li>
<li>删除默认的测试数据库，取消测试数据库的一系列访问权限。</li>
<li>刷新授权列表，让初始化的设定立即生效。</li>
</ul>
<p>根据以上步骤，要在终端输入命令：  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mysql_secure_installation</span><br></pre></td></tr></table></figure>


      
    </div>

    
    
    

    <footer class="post-footer">
        <div class="post-eof"></div>
      
    </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://foryoungyu.gitee.io/2021/01/08/%E3%80%90Vim%E3%80%91Vim%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/dog.jpg">
      <meta itemprop="name" content="Foryoung Yu">
      <meta itemprop="description" content="欣欣向荣">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Salt.'s Blog">
    </span>

    
    
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/01/08/%E3%80%90Vim%E3%80%91Vim%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/" class="post-title-link" itemprop="url">【Vim】Vim的基本使用</a>
        </h2>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-01-08 22:05:00" itemprop="dateCreated datePublished" datetime="2021-01-08T22:05:00+08:00">2021-01-08</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-13 22:18:58" itemprop="dateModified" datetime="2021-02-13T22:18:58+08:00">2021-02-13</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/Vim/" itemprop="url" rel="index"><span itemprop="name">Vim</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
          <h2 id="Linux-Vi-Vim"><a href="#Linux-Vi-Vim" class="headerlink" title="Linux Vi/Vim"></a>Linux Vi/Vim</h2><p>所有的 Unix Like 系统都会内建 Vi 文书编辑器，其他的文书编辑器则不一定会存在。<br>在 GNU 项目中，程序员在将 Vi 编辑器移植到开源世界的同时，决定对其作一些改进。<br>由于改进后的 Vi 不再是以前 Unix 中的那个原始的 Vi 编辑器了，开发人员也就将它重命名为“Vi improved”，也就是 Vim。<br>但是目前我们使用比较多的是 Vim 编辑器。Vim 具有程序编辑的能力，可以主动的以字体颜色辨别语法的正确性，方便程序设计。</p>
<h2 id="什么是Vim"><a href="#什么是Vim" class="headerlink" title="什么是Vim"></a>什么是Vim</h2><p>Vim是从 Vi 发展出来的一个文本编辑器。代码补全、编译及错误跳转等方便编程的功能特别丰富，在程序员中被广泛使用，和Emacs并列成为类Unix系统用户最喜欢的文本编辑器。</p>
<p>简单的来说， Vi 是老式的字处理器，功能已经很齐全了，但是还是有可以进步的地方。 Vim 则可以说是程序开发者的一项很好用的工具。</p>
<p><strong>Vim键位图:</strong><br><img src="/images/vi-vim.gif" alt="Vim键位图"></p>
<p>看起来是不是很复杂？不用担心，但其实常用的也就那么几个，而且命令之间也很具有逻辑性，非常好记。</p>
<h2 id="Vim的使用"><a href="#Vim的使用" class="headerlink" title="Vim的使用"></a>Vim的使用</h2><p>基本上 Vim 共分为三种模式，分别是<strong>命令模式（Command mode）</strong>，<strong>输入模式（Insert mode）</strong>和<strong>底线命令模式（Last line mode）</strong>。这三种模式的作用分别是：</p>
<p><strong>命令模式</strong><br>命令模式就是刚刚进入Vim的时候默认的模式。  </p>
<p>此时如果敲击键盘会被识别为命令。以下是常用的几个命令：</p>
<ul>
<li><strong>i</strong> 切换到输入模式，以输入字符。</li>
<li><strong>x</strong> 删除当前光标所在处的字符。</li>
<li><strong>:</strong> 切换到底线命令模式，以在最底一行输入命令。</li>
</ul>
<p><strong>输入模式</strong><br>在命令模式下按下i就进入了输入模式。<br>在输入模式中，可以使用以下按键：  </p>
<ul>
<li>字符按键以及Shift组合，输入字符</li>
<li>ENTER，回车键，换行</li>
<li>BACKSPACE，退格键，删除光标前一个字符</li>
<li>DEL，删除键，删除光标后一个字符</li>
<li>方向键，在文本中移动光标</li>
<li>HOME/END，移动光标到行首/行尾</li>
<li>Page Up/Page Down，上/下翻页</li>
<li>Insert，切换光标为输入/替换模式，光标将变成竖线/下划线</li>
<li>ESC，退出输入模式，切换到命令模式</li>
</ul>
<p><strong>底线命令模式</strong><br>在命令模式下按下:（英文冒号）就进入了底线命令模式。<br>底线命令模式可以输入单个或多个字符的命令，可用的命令非常多。<br>在底线命令模式中，基本的命令有（已经省略了冒号）：</p>
<ul>
<li><strong>q</strong> 退出程序</li>
<li><strong>w</strong> 保存文件</li>
</ul>
<p>按ESC键可随时退出底线命令模式。<br>简单的说，我们可以将这三个模式想成底下的图标来表示：<br><img src="/images/vim%E5%B7%A5%E4%BD%9C%E6%A8%A1%E5%BC%8F.png" alt="Vim的三种工作模式"></p>
<h2 id="Vim的按键说明"><a href="#Vim的按键说明" class="headerlink" title="Vim的按键说明"></a>Vim的按键说明</h2><p>以上只是基本操作，还有许多的命令可以学习，并且很具有逻辑性。</p>
<h3 id="第一部分-一般模式可用的光标移动、选择复制粘贴、搜索替换等"><a href="#第一部分-一般模式可用的光标移动、选择复制粘贴、搜索替换等" class="headerlink" title="第一部分 一般模式可用的光标移动、选择复制粘贴、搜索替换等"></a>第一部分 一般模式可用的光标移动、选择复制粘贴、搜索替换等</h3><h4 id="移动光标的方法"><a href="#移动光标的方法" class="headerlink" title="移动光标的方法"></a>移动光标的方法</h4><table>
<thead>
<tr>
<th align="center">按键</th>
<th align="center">作用</th>
</tr>
</thead>
<tbody><tr>
<td align="center">h 或 向左箭头键(←) 或 [backspace]</td>
<td align="center">光标向左移动一个字符</td>
</tr>
<tr>
<td align="center">j 或 向下箭头键(↓) 或 [enter]</td>
<td align="center">光标向下移动一个字符</td>
</tr>
<tr>
<td align="center">k 或 向上箭头键(↑)</td>
<td align="center">光标向上移动一个字符</td>
</tr>
<tr>
<td align="center">l 或 向右箭头键(→) 或 [space]</td>
<td align="center">光标向右移动一个字符</td>
</tr>
<tr>
<td align="center">[Ctrl] + [f]</td>
<td align="center">屏幕『向下』移动一页，相当于 [Page Down]按键 (常用)</td>
</tr>
<tr>
<td align="center">[Ctrl] + [b]</td>
<td align="center">屏幕『向上』移动一页，相当于 [Page Up] 按键 (常用)</td>
</tr>
<tr>
<td align="center">[Ctrl] + [d]</td>
<td align="center">屏幕『向下』移动半页</td>
</tr>
<tr>
<td align="center">[Ctrl] + [u]</td>
<td align="center">屏幕『向上』移动半页</td>
</tr>
<tr>
<td align="center">0 或功能键[Home]</td>
<td align="center">这是数字『 0 』：移动到这一行的最前面字符处 (常用)</td>
</tr>
<tr>
<td align="center">$ 或功能键[End]</td>
<td align="center">移动到这一行的最后面字符处(常用)</td>
</tr>
<tr>
<td align="center">H</td>
<td align="center">光标移动到这个屏幕的最上方那一行的第一个字符</td>
</tr>
<tr>
<td align="center">M</td>
<td align="center">光标移动到这个屏幕的中央那一行的第一个字符</td>
</tr>
<tr>
<td align="center">L</td>
<td align="center">光标移动到这个屏幕的最下方那一行的第一个字符</td>
</tr>
<tr>
<td align="center">G</td>
<td align="center">移动到这个档案的最后一行(常用)</td>
</tr>
<tr>
<td align="center">nG</td>
<td align="center">n 为数字。移动到这个档案的第 n 行。</td>
</tr>
<tr>
<td align="center">gg</td>
<td align="center">移动到这个档案的第一行，相当于 1G 啊！ (常用)</td>
</tr>
<tr>
<td align="center">n[Enter]</td>
<td align="center">n 为数字。光标向下移动 n 行(常用)</td>
</tr>
</tbody></table>
<blockquote>
<p>如果想要进行多次移动的话，例如向下移动 30 行，可以使用 “30j” 或 “30↓” 的组合按键， 亦即加上想要进行的次数(数字)后，按下动作即可！<br>其实很多的命令只要先加数字都可以实现类似的功能。比如删除命令<code>dd</code>，要想删除下两行，可以使用<code>2dd</code>。</p>
</blockquote>
<h4 id="搜索替换"><a href="#搜索替换" class="headerlink" title="搜索替换"></a>搜索替换</h4><table>
<thead>
<tr>
<th align="center">按键</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td align="center">/word</td>
<td>向光标之下寻找一个名称为 word 的字符串。例如要在档案内搜寻 vbird 这个字符串，就输入 /vbird 即可！ (常用)</td>
</tr>
<tr>
<td align="center">?word</td>
<td>向光标之上寻找一个字符串名称为 word 的字符串。</td>
</tr>
<tr>
<td align="center">n</td>
<td>重复前一个<strong>搜寻</strong>的动作。</td>
</tr>
<tr>
<td align="center">N</td>
<td>与 n 刚好相反，为『反向』进行前一个<strong>搜寻</strong>动作。 例如 /vbird 后，按下 N 则表示『向上』搜寻 vbird 。</td>
</tr>
</tbody></table>
<blockquote>
<p>使用 /word 配合 n 及 N 是非常有帮助的！可以让你重复的找到一些你搜寻的关键词！</p>
</blockquote>
<h4 id="选择、删除、复制与粘贴"><a href="#选择、删除、复制与粘贴" class="headerlink" title="选择、删除、复制与粘贴"></a>选择、删除、复制与粘贴</h4><table>
<thead>
<tr>
<th align="center">按键</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td align="center">v</td>
<td>进入按字符选择模式,通过h、i、j、k键移动光标选择要进行复制的字符串</td>
</tr>
<tr>
<td align="center">V</td>
<td>进入按行选择模式，通过h、i、j、k键移动光标选择要进行复制的行号</td>
</tr>
<tr>
<td align="center">[Ctrl]+v</td>
<td>进入到按块选择模式，通过h、i、j、k移动鼠标选择要进行复制的区域块</td>
</tr>
<tr>
<td align="center">x</td>
<td>向后删除一个字符 (相当于 [del] 按键)。</td>
</tr>
<tr>
<td align="center">X</td>
<td>向前删除一个字符(相当于 [backspace] 亦即是退格键) (常用)</td>
</tr>
<tr>
<td align="center">nx</td>
<td>n 为数字，连续向后删除 n 个字符。举例来说，我要连续删除 10 个字符， 『10x』。</td>
</tr>
<tr>
<td align="center">dd</td>
<td>删除游标所在的那一整行(常用)</td>
</tr>
<tr>
<td align="center">ndd</td>
<td>n 为数字。删除光标所在的向下 n 行，例如 20dd 则是删除 20 行 (常用)</td>
</tr>
<tr>
<td align="center">d1G 或 dgg</td>
<td>删除光标所在到第一行的所有数据</td>
</tr>
<tr>
<td align="center">dG</td>
<td>删除光标所在到最后一行的所有数据</td>
</tr>
<tr>
<td align="center">d$</td>
<td>删除游标所在处，到该行的最后一个字符</td>
</tr>
<tr>
<td align="center">d0</td>
<td>那个是数字的 0 ，删除游标所在处，到该行的最前面一个字符</td>
</tr>
<tr>
<td align="center">yy</td>
<td>复制游标所在的那一行(常用)</td>
</tr>
<tr>
<td align="center">nyy</td>
<td>n 为数字。复制光标所在的向下 n 行，例如 20yy 则是复制 20 行(常用)</td>
</tr>
<tr>
<td align="center">y1G 或 ygg</td>
<td>复制游标所在行到第一行的所有数据</td>
</tr>
<tr>
<td align="center">yG</td>
<td>复制游标所在行到最后一行的所有数据</td>
</tr>
<tr>
<td align="center">y0</td>
<td>复制光标所在的那个字符到该行行首的所有数据</td>
</tr>
<tr>
<td align="center">y$</td>
<td>复制光标所在的那个字符到该行行尾的所有数据</td>
</tr>
<tr>
<td align="center">p</td>
<td>将已复制的数据在光标下一行贴上</td>
</tr>
<tr>
<td align="center">P</td>
<td>将已复制的数据在光标上一行贴上</td>
</tr>
<tr>
<td align="center">J</td>
<td>将光标所在行与下一行的数据结合成同一行</td>
</tr>
<tr>
<td align="center">c</td>
<td>重复删除多个数据，例如向下删除 10 行，[ 10cj ]</td>
</tr>
<tr>
<td align="center">u</td>
<td><strong>撤销</strong>上一步的操作。(常用)</td>
</tr>
<tr>
<td align="center">[Ctrl]+r</td>
<td><strong>重做（前进）</strong>上一个动作。(常用)</td>
</tr>
<tr>
<td align="center">.</td>
<td>这是就是小数点。表示重复前一个动作。如果你想要重复删除、重复贴上等等动作，按下小数点『.』就好了！ (常用)</td>
</tr>
</tbody></table>
<blockquote>
<p>u 与 [Ctrl]+r 是很常用的指令，表示前进和后退。另外「.」这个指令表示重复刚刚的动作，也非常常用。</p>
</blockquote>
<h3 id="第二部分：一般模式切换到编辑模式的可用的按钮说明"><a href="#第二部分：一般模式切换到编辑模式的可用的按钮说明" class="headerlink" title="第二部分：一般模式切换到编辑模式的可用的按钮说明"></a>第二部分：一般模式切换到编辑模式的可用的按钮说明</h3><table>
<thead>
<tr>
<th align="center">按键</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td align="center">i, I</td>
<td>进入输入模式(Insert mode)：i 为『从目前光标所在处输入』， I 为『在目前所在行的第一个非空格符处开始输入』。 (常用)</td>
</tr>
<tr>
<td align="center">a, A</td>
<td>进入输入模式(Insert mode)：a 为『从目前光标所在的下一个字符处开始输入』， A 为『从光标所在行的最后一个字符处开始输入』。(常用)</td>
</tr>
<tr>
<td align="center">o, O</td>
<td>进入输入模式(Insert mode)：这是英文字母 o 的大小写。o 为在目前光标所在的下一行处输入新的一行； O 为在目前光标所在的上一行处输入新的一行！(常用)</td>
</tr>
<tr>
<td align="center">r, R</td>
<td>进入取代模式(Replace mode)：r 只会取代光标所在的那一个字符一次；R会一直取代光标所在的文字，直到按下 ESC 为止；(常用)</td>
</tr>
<tr>
<td align="center">[Esc]</td>
<td>退出编辑模式，回到一般模式中(常用)</td>
</tr>
</tbody></table>
<h3 id="第三部分：一般模式切换到指令行模式的可用的按钮说明"><a href="#第三部分：一般模式切换到指令行模式的可用的按钮说明" class="headerlink" title="第三部分：一般模式切换到指令行模式的可用的按钮说明"></a>第三部分：一般模式切换到指令行模式的可用的按钮说明</h3><h4 id="指令行的储存、离开等指令"><a href="#指令行的储存、离开等指令" class="headerlink" title="指令行的储存、离开等指令"></a>指令行的储存、离开等指令</h4><table>
<thead>
<tr>
<th align="center">按键</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td align="center">:w</td>
<td>将编辑的数据写入硬盘档案中(常用)</td>
</tr>
<tr>
<td align="center">:w!</td>
<td>若文件属性为『只读』时，强制写入该档案。不过，到底能不能写入， 还是跟你对该档案的档案权限有关啊！</td>
</tr>
<tr>
<td align="center">:q</td>
<td>离开 vim (常用)</td>
</tr>
<tr>
<td align="center">:q!</td>
<td>若曾修改过档案，又不想储存，使用 ! 为强制离开不储存档案。</td>
</tr>
<tr>
<td align="center">:wq</td>
<td>储存后离开，若为 :wq! 则为强制储存后离开 (常用)</td>
</tr>
<tr>
<td align="center">ZZ</td>
<td>这是大写的 Z 喔！如果修改过，保存当前文件，然后退出！效果等同于(保存并退出)</td>
</tr>
<tr>
<td align="center">ZQ</td>
<td>不保存，强制退出。效果等同于 :q!。</td>
</tr>
<tr>
<td align="center">:w [filename]</td>
<td>将编辑的数据储存成另一个档案（类似另存新档）</td>
</tr>
<tr>
<td align="center">:r [filename]</td>
<td>在编辑的数据中，读入另一个档案的数据。亦即将 『filename』 这个档案内容加到游标所在行后面</td>
</tr>
<tr>
<td align="center">:n1,n2 w [filename]</td>
<td>将 n1 到 n2 的内容储存成 filename 这个档案。</td>
</tr>
<tr>
<td align="center">:! command</td>
<td>暂时离开 vi 到指令行模式下执行 command 的显示结果！例如『:! ls /home』即可在 vi 当中察看 /home 底下以 ls 输出的档案信息！</td>
</tr>
</tbody></table>
<blockquote>
<p>注意一下啊，那个惊叹号 (!) 在 vi 当中，常常具有『强制』的意思～</p>
</blockquote>
<h2 id="其他技巧"><a href="#其他技巧" class="headerlink" title="其他技巧"></a>其他技巧</h2><h3 id="批量注释"><a href="#批量注释" class="headerlink" title="批量注释"></a>批量注释</h3><p>[Ctrl] + v 进入块选择模式，然后移动光标选中你要注释的行，再按大写的 I 进入行首插入模式输入注释符号如 // 或 #，输入完毕之后，按两下 ESC，Vim 会自动将你选中的所有行首都加上注释，保存退出完成注释。</p>
<p>取消注释：</p>
<p>[Ctrl] + v 进入块选择模式，选中你要删除的行首的注释符号，注意 // 要选中两个，选好之后按 d 即可删除注释，ESC 保存退出。</p>
<blockquote>
<p>本文参考：<a target="_blank" rel="noopener" href="https://www.runoob.com/linux/linux-vim.html">菜鸟编程 Linux vi/vim</a></p>
</blockquote>

      
    </div>

    
    
    

    <footer class="post-footer">
        <div class="post-eof"></div>
      
    </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://foryoungyu.gitee.io/2020/12/31/%E3%80%90Linux%E3%80%91SSH%E7%9A%84%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/dog.jpg">
      <meta itemprop="name" content="Foryoung Yu">
      <meta itemprop="description" content="欣欣向荣">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Salt.'s Blog">
    </span>

    
    
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/12/31/%E3%80%90Linux%E3%80%91SSH%E7%9A%84%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95/" class="post-title-link" itemprop="url">【Linux】SSH的基本使用</a>
        </h2>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2020-12-31 00:00:00" itemprop="dateCreated datePublished" datetime="2020-12-31T00:00:00+08:00">2020-12-31</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-13 22:18:58" itemprop="dateModified" datetime="2021-02-13T22:18:58+08:00">2021-02-13</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/Linux/" itemprop="url" rel="index"><span itemprop="name">Linux</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
          <h2 id="基础"><a href="#基础" class="headerlink" title="基础"></a>基础</h2><p>在 Linux 系统上 SSH 是非常常用的工具，通过 SSH Client 我们可以连接到运行了 SSH Server 的远程机器上。SSH Client 的基本使用方法是：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh user@remote -p port</span><br></pre></td></tr></table></figure>
<ul>
<li>user 是你在远程机器上的用户名，如果不指定的话默认为当前用户  </li>
<li>remote 是远程机器的地址，可以是 IP，域名，或者是后面会提到的别名  </li>
<li>port 是 SSH Server 监听的端口，如果不指定的话就为默认值 22 </li>
</ul>
<p>在执行了 ssh 命令之后，远程机器会询问你的密码。在输入密码的时候，屏幕上不会显示明文密码，也不会显示 <strong>**</strong>，这样别人就不会看到你的密码长度了，按下回车即可登入。</p>
<p>登入之后，就可以远程控制机器啦！</p>
<h2 id="安装OpenSSH-Server"><a href="#安装OpenSSH-Server" class="headerlink" title="安装OpenSSH Server"></a>安装OpenSSH Server</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">local$ ssh user@remote -p port </span><br><span class="line">ssh: connect to host remote port 22: Connection refused</span><br></pre></td></tr></table></figure>
<p>如果你遇到了上面的消息，说明在远程机器上没有安装 SSH Server，特别地，如果远程机器运行的是 Ubuntu Desktop 系统，那么默认是没有安装 SSH Server 的。这个时候，你可以联系管理员让他安装 SSH Server，或者如果你有 sudo 权限的话，可以执行下面命令安装：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install openssh-server</span><br></pre></td></tr></table></figure>
<p>相应的本地机器需要执行下面的命令：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install openssh-client</span><br></pre></td></tr></table></figure>
<h2 id="免密码登入"><a href="#免密码登入" class="headerlink" title="免密码登入"></a>免密码登入</h2><p>在本地机器输入下面指令生成 SSH 钥匙，一路回车即可。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen</span><br></pre></td></tr></table></figure>
<p>输出的内容告诉了我们，生成的公钥放在了 ~/.ssh/id_rsa.pub，私钥放在了 ~/.ssh/id_rsa。接下来，我们要让远程机器记住我们的公钥。最简单的方法是</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-copy-id user@remote -p port</span><br></pre></td></tr></table></figure>

<h2 id="配置别名"><a href="#配置别名" class="headerlink" title="配置别名"></a>配置别名</h2><p>每次都输入 ssh user@remote -p port，时间久了也会觉得很麻烦，特别是当 user, remote 和 port 都得输入，而且还不好记忆的时候。配置别名可以让我们进一步偷懒。</p>
<p>比如我想用 ssh lab 来替代上面这么一长串，那么在 ~/.ssh/config 里面追加以下内容：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">Host lab</span><br><span class="line">    HostName remote</span><br><span class="line">    User user</span><br><span class="line">    Port port</span><br></pre></td></tr></table></figure>
<p>保存之后，即可用 ssh lab 登入，如果还配置了公钥登入，那就连密码都不用输入了。</p>
<h2 id="传输文件"><a href="#传输文件" class="headerlink" title="传输文件"></a>传输文件</h2><p>在两台机之间传输文件可以用 scp，它的地址格式与 ssh 基本相同，都是可以省略用户名和端口，稍微的差别在与指定端口时用的是大写的 -P 而不是小写的。不过，如果你已经配置了别名，那么这都不重要，因为 scp 也支持直接用别名。scp 用起来很简单，看看下面的例子就明白了：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"># 把本地的 &#x2F;path&#x2F;to&#x2F;local&#x2F;file 文件传输到远程的 &#x2F;path&#x2F;to&#x2F;remote&#x2F;file</span><br><span class="line">scp -P port &#x2F;path&#x2F;to&#x2F;local&#x2F;file user@remote:&#x2F;path&#x2F;to&#x2F;remote&#x2F;file</span><br><span class="line"></span><br><span class="line"># 也可以使用别名</span><br><span class="line">scp &#x2F;path&#x2F;to&#x2F;local&#x2F;file lab:&#x2F;path&#x2F;to&#x2F;remote&#x2F;file</span><br><span class="line"></span><br><span class="line"># 把远程的 &#x2F;path&#x2F;to&#x2F;remote&#x2F;file 下载到本地的 &#x2F;path&#x2F;to&#x2F;local&#x2F;file</span><br><span class="line">scp lab:&#x2F;path&#x2F;to&#x2F;remote&#x2F;file &#x2F;path&#x2F;to&#x2F;local&#x2F;file</span><br><span class="line"></span><br><span class="line"># 远程的默认路径是家目录</span><br><span class="line"># 下面命令把当前目录下的 file 传到远程的 ~&#x2F;dir&#x2F;file</span><br><span class="line">scp file lab:dir&#x2F;file</span><br><span class="line"></span><br><span class="line"># 加上 -r 命令可以传送文件夹</span><br><span class="line"># 下面命令可以把当前目录下的 dir 文件夹传到远程的家目录下</span><br><span class="line">scp -r dir lab:</span><br><span class="line"></span><br><span class="line"># 别忘了 . 可以用来指代当前目录</span><br><span class="line"># 下面命令可以把远程的 ~&#x2F;dir 目录下载到当前目录里面</span><br><span class="line">scp -r lab:dir&#x2F; .</span><br></pre></td></tr></table></figure>

<h2 id="保持程序在后台运行"><a href="#保持程序在后台运行" class="headerlink" title="保持程序在后台运行"></a>保持程序在后台运行</h2><p>有时候你想要在远程的机器上跑一个需要长时间运行的程序，比如一些计算，然后当你睡了一觉再登入远程的机子上却发现什么结果都没有。这是因为一旦 ssh 进程退出，所有它之前启动的程序都会被杀死。那么有什么办法可以保持程序在后台运行呢？</p>
<p>你需要在远程的机子上使用 tmux。tmux 是一个会话管理程序，他会保持程序一直运行着。在 Ubuntu 上你可以通过 sudo apt-get install tmux 来安装。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">remote$ tmux</span><br></pre></td></tr></table></figure>
<p>这样你就进入到了 tmux 管理的会话中，之后你再运行任何东西都不会因为你退出 ssh 而被杀死。要暂时离开这个会话，可以先按下 ctrl+b 再按下 d。要恢复之前的会话，只需要执行</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">remote$ tmux attach</span><br></pre></td></tr></table></figure>
<p>tmux 还能管理多个窗口、水平竖直切分、复制粘贴等等，你可以看看<a href="https://link.zhihu.com/?target=http://blog.jobbole.com/87584/">这篇不错的文章</a>来入门。</p>
<p>如果你是Mac用户，那么十分幸运的是，你几乎不需要任何学习，只要把你的终端由系统自带的 Terminal 换成 iTerm 2。iTerm 2 自带超好的 tmux 支持，你可以像操作本机的标签页一样操作 tmux 会话。你只需要在新建会话的时候使用 tmux -CC，在恢复的时候使用 tmux -CC attach 即可。具体的可以参见 iTerm2 and tmux Integration。</p>
<p>最后强调一遍，tmux 应该运行在远程的机子上，而不是本机上，否则程序在 ssh 退出时依然会被杀死。</p>
<blockquote>
<p>本文参考：<a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/21999778">SSH 基本用法</a> </p>
</blockquote>

      
    </div>

    
    
    

    <footer class="post-footer">
        <div class="post-eof"></div>
      
    </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://foryoungyu.gitee.io/2020/12/31/%E3%80%90%E5%8D%9A%E5%AE%A2%E3%80%91%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/dog.jpg">
      <meta itemprop="name" content="Foryoung Yu">
      <meta itemprop="description" content="欣欣向荣">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Salt.'s Blog">
    </span>

    
    
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/12/31/%E3%80%90%E5%8D%9A%E5%AE%A2%E3%80%91%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/" class="post-title-link" itemprop="url">【博客】博客搭建</a>
        </h2>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2020-12-31 00:00:00" itemprop="dateCreated datePublished" datetime="2020-12-31T00:00:00+08:00">2020-12-31</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-13 22:18:58" itemprop="dateModified" datetime="2021-02-13T22:18:58+08:00">2021-02-13</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%8D%9A%E5%AE%A2/" itemprop="url" rel="index"><span itemprop="name">博客</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
          <p>博客是记录生活，学习的和工作的强大载体，能够帮助你快速的回忆起自己的所整理的知识，所做的笔记。  </p>
<p>我的博客是使用<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/index.html">Hexo</a>博客框架，<a target="_blank" rel="noopener" href="https://theme-next.js.org/">NexT</a>主题搭建的。  </p>
<p>Hexo是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown（或其他渲染引擎）解析文章，在几秒内，即可利用靓丽的主题生成静态网页。</p>
<h2 id="Hexo的安装"><a href="#Hexo的安装" class="headerlink" title="Hexo的安装"></a>Hexo的安装</h2><h3 id="安装前提"><a href="#安装前提" class="headerlink" title="安装前提"></a>安装前提</h3><p>安装 Hexo 相当简单，只需要先安装下列应用程序即可：</p>
<ul>
<li>Git</li>
<li>Node.js</li>
</ul>
<p>如果您的电脑中已经安装上述必备程序，那么恭喜您！你可以直接前往 安装 Hexo 步骤。</p>
<p>如果您的电脑中尚未安装所需要的程序，请根据以下安装指示完成安装。</p>
<h3 id="安装Git"><a href="#安装Git" class="headerlink" title="安装Git"></a>安装Git</h3><ul>
<li>Windows：下载并安装<a target="_blank" rel="noopener" href="https://git-scm.com/download/win">git</a>.</li>
<li>Mac：使用<a target="_blank" rel="noopener" href="https://brew.sh/">Homebrew</a>, <a target="_blank" rel="noopener" href="https://www.macports.org/">MacPorts</a> 或者下载<a target="_blank" rel="noopener" href="http://sourceforge.net/projects/git-osx-installer/">安装程序</a>。</li>
<li>Linux (Ubuntu, Debian)：sudo apt-get install git-core</li>
<li>Linux (Fedora, Red Hat, CentOS)：sudo yum install git-core</li>
</ul>
<h3 id="安装Node-js"><a href="#安装Node-js" class="headerlink" title="安装Node.js"></a>安装Node.js</h3><p>Node.js 为大多数平台提供了官方的<a target="_blank" rel="noopener" href="https://nodejs.org/en/download/">安装程序</a>。对于中国大陆地区用户，可以前往<a target="_blank" rel="noopener" href="https://npm.taobao.org/mirrors/node">淘宝 Node.js</a>镜像 下载。</p>
<p><a target="_blank" rel="noopener" href="https://nodejs.org/en/download/package-manager/">Installing Node.js via package manager</a></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -S nodejs npm</span><br></pre></td></tr></table></figure>

<p>其它的安装方法：</p>
<ul>
<li>Windows：通过<a target="_blank" rel="noopener" href="https://github.com/jasongin/nvs/">nvs</a>（推荐）或者<a target="_blank" rel="noopener" href="https://github.com/nvm-sh/nvm">nvm</a> 安装。</li>
<li>Mac：使用<a target="_blank" rel="noopener" href="https://brew.sh/">Homebrew</a>或<a target="_blank" rel="noopener" href="http://www.macports.org/">MacPorts</a>安装。</li>
<li>Linux（DEB/RPM-based）：从<a target="_blank" rel="noopener" href="https://github.com/nodesource/distributions">NodeSource</a> 安装。</li>
</ul>
<h3 id="安装Hexo"><a href="#安装Hexo" class="headerlink" title="安装Hexo"></a>安装Hexo</h3><p>所有必备的应用程序安装完成后，即可使用 npm 安装 Hexo。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli # 注意权限的限制，安装不上使用sudo</span><br></pre></td></tr></table></figure>

<h3 id="进阶安装和使用"><a href="#进阶安装和使用" class="headerlink" title="进阶安装和使用"></a>进阶安装和使用</h3><p>对于熟悉 npm 的进阶用户，可以仅局部安装 hexo 包。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo</span><br></pre></td></tr></table></figure>

<p>在终端中输入<code>hexo version</code>，若输出版本序列则安装成功。</p>
<h2 id="Hexo的使用"><a href="#Hexo的使用" class="headerlink" title="Hexo的使用"></a>Hexo的使用</h2><p>初次使用Hexo，先要把和hexo环境下载到本地，使用一下命令：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo init           #在当前文件夹下载</span><br><span class="line">hexo init &lt;Path&gt;    #指定目录下载</span><br></pre></td></tr></table></figure>
<p>命令执行后，会发现有许多的文件，在指定的目录下。输入网址<a target="_blank" rel="noopener" href="http://localhost:4000/">http://localhost:4000</a>可以查看到博客。</p>
<h2 id="使用NexT主题"><a href="#使用NexT主题" class="headerlink" title="使用NexT主题"></a>使用NexT主题</h2><p><a target="_blank" rel="noopener" href="https://theme-next.js.org/">NexT官网</a></p>
<h3 id="下载NexT主题到本地"><a href="#下载NexT主题到本地" class="headerlink" title="下载NexT主题到本地"></a>下载NexT主题到本地</h3><p>将next克隆到theme目录下的next目录中：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone https:&#x2F;&#x2F;github.com&#x2F;next-theme&#x2F;hexo-theme-next themes&#x2F;next</span><br></pre></td></tr></table></figure>
<h3 id="启用NexT"><a href="#启用NexT" class="headerlink" title="启用NexT"></a>启用NexT</h3><p>进入到博客目录下，找到_config.yml文件，打开后找到<code>theme</code>选项，将其值设定为next。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo s</span><br></pre></td></tr></table></figure>
<p>如此，就可以预览到了当前Next主题了。</p>
<h2 id="部署网站"><a href="#部署网站" class="headerlink" title="部署网站"></a>部署网站</h2><h3 id="安装-hexo-deployer-git"><a href="#安装-hexo-deployer-git" class="headerlink" title="安装 hexo-deployer-git"></a>安装 hexo-deployer-git</h3><p>输入命令安装hexo-deployer-git</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>

<h3 id="修改配置"><a href="#修改配置" class="headerlink" title="修改配置"></a>修改配置</h3><p>在_config.yml文件中的deploy参数格式：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repo: &lt;repository url&gt;</span><br><span class="line">  branch: [branch]</span><br><span class="line">  message: [message]</span><br></pre></td></tr></table></figure>
<p>参考如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">  type: git # 部署工具种类</span><br><span class="line">  repo: https:&#x2F;&#x2F;gitee.com&#x2F;foryoungyu&#x2F;foryoungyu.git # 远程仓库地址</span><br><span class="line">  branch: master # 分支</span><br></pre></td></tr></table></figure>
<p>之后执行</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo clean </span><br><span class="line">hexo g </span><br><span class="line">hexo d</span><br></pre></td></tr></table></figure>

      
    </div>

    
    
    

    <footer class="post-footer">
        <div class="post-eof"></div>
      
    </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://foryoungyu.gitee.io/2020/06/25/%E3%80%90C-C-%E3%80%91C-%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/dog.jpg">
      <meta itemprop="name" content="Foryoung Yu">
      <meta itemprop="description" content="欣欣向荣">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Salt.'s Blog">
    </span>

    
    
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/06/25/%E3%80%90C-C-%E3%80%91C-%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6/" class="post-title-link" itemprop="url">【C/C++】VScode配置C++调试的配置文件</a>
        </h2>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2020-06-25 00:00:00" itemprop="dateCreated datePublished" datetime="2020-06-25T00:00:00+08:00">2020-06-25</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-13 22:18:58" itemprop="dateModified" datetime="2021-02-13T22:18:58+08:00">2021-02-13</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/VSCode/" itemprop="url" rel="index"><span itemprop="name">VSCode</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
          <h1 id="C-配置文件"><a href="#C-配置文件" class="headerlink" title="C++配置文件"></a>C++配置文件</h1><p>将以下两个文件内容复制到工作目录.vscode下。</p>
<h2 id="launch-json"><a href="#launch-json" class="headerlink" title="launch.json"></a>launch.json</h2><figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="comment">// Use IntelliSense to learn about possible attributes.</span></span><br><span class="line">  <span class="comment">// Hover to view descriptions of existing attributes.</span></span><br><span class="line">  <span class="comment">// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387</span></span><br><span class="line">  <span class="attr">&quot;version&quot;</span>: <span class="string">&quot;0.2.0&quot;</span>,</span><br><span class="line">  <span class="attr">&quot;configurations&quot;</span>: [</span><br><span class="line">    &#123;</span><br><span class="line">      <span class="attr">&quot;name&quot;</span>: <span class="string">&quot;Python: 当前文件&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;type&quot;</span>: <span class="string">&quot;python&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;request&quot;</span>: <span class="string">&quot;launch&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;program&quot;</span>: <span class="string">&quot;$&#123;file&#125;&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;console&quot;</span>: <span class="string">&quot;integratedTerminal&quot;</span></span><br><span class="line">    &#125;,</span><br><span class="line">    &#123;</span><br><span class="line">      <span class="attr">&quot;name&quot;</span>: <span class="string">&quot;gdb调试&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;type&quot;</span>: <span class="string">&quot;cppdbg&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;request&quot;</span>: <span class="string">&quot;launch&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;program&quot;</span>: <span class="string">&quot;$&#123;fileDirname&#125;\\$&#123;fileBasenameNoExtension&#125;.exe&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;args&quot;</span>: [],</span><br><span class="line">      <span class="attr">&quot;stopAtEntry&quot;</span>: <span class="literal">false</span>,</span><br><span class="line">      <span class="attr">&quot;cwd&quot;</span>: <span class="string">&quot;$&#123;workspaceFolder&#125;&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;environment&quot;</span>: [],</span><br><span class="line">      <span class="attr">&quot;externalConsole&quot;</span>: <span class="literal">false</span>,</span><br><span class="line">      <span class="attr">&quot;MIMode&quot;</span>: <span class="string">&quot;gdb&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;miDebuggerPath&quot;</span>: <span class="string">&quot;C:\\MinGW\\bin\\gdb.exe&quot;</span>,</span><br><span class="line">      <span class="attr">&quot;setupCommands&quot;</span>: [</span><br><span class="line">        &#123;</span><br><span class="line">          <span class="attr">&quot;description&quot;</span>: <span class="string">&quot;为 gdb 启用整齐打印&quot;</span>,</span><br><span class="line">          <span class="attr">&quot;text&quot;</span>: <span class="string">&quot;-enable-pretty-printing&quot;</span>,</span><br><span class="line">          <span class="attr">&quot;ignoreFailures&quot;</span>: <span class="literal">true</span></span><br><span class="line">        &#125;</span><br><span class="line">      ],</span><br><span class="line">      <span class="attr">&quot;preLaunchTask&quot;</span>: <span class="string">&quot;C/C++: g++.exe build active file&quot;</span></span><br><span class="line">    &#125;</span><br><span class="line">  ]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="tasks-json"><a href="#tasks-json" class="headerlink" title="tasks.json"></a>tasks.json</h2><p>注意修改command和cwd为你自己的目录。</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">    <span class="attr">&quot;tasks&quot;</span>: [</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="attr">&quot;type&quot;</span>: <span class="string">&quot;shell&quot;</span>,</span><br><span class="line">            <span class="attr">&quot;label&quot;</span>: <span class="string">&quot;C/C++: g++.exe build active file&quot;</span>,</span><br><span class="line">            <span class="attr">&quot;command&quot;</span>: <span class="string">&quot;C:\\MinGW\\bin\\g++.exe&quot;</span>,</span><br><span class="line">            <span class="attr">&quot;args&quot;</span>: [</span><br><span class="line">                <span class="string">&quot;-g&quot;</span>,</span><br><span class="line">                <span class="string">&quot;$&#123;file&#125;&quot;</span>,</span><br><span class="line">                <span class="string">&quot;-o&quot;</span>,</span><br><span class="line">                <span class="string">&quot;$&#123;fileDirname&#125;\\$&#123;fileBasenameNoExtension&#125;.exe&quot;</span></span><br><span class="line">            ],</span><br><span class="line">            <span class="attr">&quot;options&quot;</span>: &#123;</span><br><span class="line">                <span class="attr">&quot;cwd&quot;</span>: <span class="string">&quot;$&#123;workspaceFolder&#125;&quot;</span></span><br><span class="line">            &#125;,</span><br><span class="line">            <span class="attr">&quot;problemMatcher&quot;</span>: [</span><br><span class="line">                <span class="string">&quot;$gcc&quot;</span></span><br><span class="line">            ],</span><br><span class="line">            <span class="attr">&quot;group&quot;</span>: &#123;</span><br><span class="line">                <span class="attr">&quot;kind&quot;</span>: <span class="string">&quot;build&quot;</span>,</span><br><span class="line">                <span class="attr">&quot;isDefault&quot;</span>: <span class="literal">true</span></span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    ],</span><br><span class="line">    <span class="attr">&quot;version&quot;</span>: <span class="string">&quot;2.0.0&quot;</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="c-cpp-properties-json"><a href="#c-cpp-properties-json" class="headerlink" title="c_cpp_properties.json"></a>c_cpp_properties.json</h2><figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">    <span class="attr">&quot;configurations&quot;</span>: [</span><br><span class="line">        &#123;</span><br><span class="line">            <span class="attr">&quot;name&quot;</span>: <span class="string">&quot;Win32&quot;</span>,</span><br><span class="line">            <span class="attr">&quot;includePath&quot;</span>: [</span><br><span class="line">                <span class="string">&quot;$&#123;workspaceFolder&#125;/**&quot;</span></span><br><span class="line">            ],</span><br><span class="line">            <span class="attr">&quot;compilerPath&quot;</span>: <span class="string">&quot;C:\\MinGW\\bin\\g++.exe&quot;</span>,</span><br><span class="line">            <span class="attr">&quot;defines&quot;</span>: [</span><br><span class="line">                <span class="string">&quot;_DEBUG&quot;</span>,</span><br><span class="line">                <span class="string">&quot;UNICODE&quot;</span>,</span><br><span class="line">                <span class="string">&quot;_UNICODE&quot;</span></span><br><span class="line">            ],</span><br><span class="line">            <span class="attr">&quot;intelliSenseMode&quot;</span>: <span class="string">&quot;gcc-x64&quot;</span></span><br><span class="line">        &#125;</span><br><span class="line">    ],</span><br><span class="line">    <span class="attr">&quot;version&quot;</span>: <span class="number">4</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
      
    </div>

    
    
    

    <footer class="post-footer">
        <div class="post-eof"></div>
      
    </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://foryoungyu.gitee.io/2020/06/25/%E3%80%90Linux%E3%80%91Linux-config/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/dog.jpg">
      <meta itemprop="name" content="Foryoung Yu">
      <meta itemprop="description" content="欣欣向荣">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Salt.'s Blog">
    </span>

    
    
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/06/25/%E3%80%90Linux%E3%80%91Linux-config/" class="post-title-link" itemprop="url">【Linux】Linux系统配置指南</a>
        </h2>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2020-06-25 00:00:00" itemprop="dateCreated datePublished" datetime="2020-06-25T00:00:00+08:00">2020-06-25</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-13 22:18:58" itemprop="dateModified" datetime="2021-02-13T22:18:58+08:00">2021-02-13</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/Linux/" itemprop="url" rel="index"><span itemprop="name">Linux</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
          <blockquote>
<p>Linux的配置指南<br>包括的Linux系统有Arch系（Arch、Manjaro）和Debian系（Ubuntu、deepin）<br>本仅提供常见Linux OS的配置方法，不提供系统的安装方法<br>如发现错误，欢迎指正</p>
</blockquote>
<h2 id="目录"><a href="#目录" class="headerlink" title="目录"></a>目录</h2><ul>
<li><a href="#%E7%9B%AE%E5%BD%95">目录</a></li>
<li><a href="#%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE">基本配置</a><ul>
<li><a href="#%E8%BD%AF%E4%BB%B6%E6%BA%90%E9%85%8D%E7%BD%AE">软件源配置</a></li>
<li><a href="#%E5%AE%89%E8%A3%85%E8%BE%93%E5%85%A5%E6%B3%95">安装输入法</a><ul>
<li><a href="#fcitx">fcitx</a></li>
<li><a href="#ibusgnome%E6%A1%8C%E9%9D%A2">ibus(gnome桌面)</a></li>
</ul>
</li>
<li><a href="#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6">配置文件</a></li>
<li><a href="#nvidia%E6%98%BE%E5%8D%A1%E9%85%8D%E7%BD%AE">NVIDIA显卡配置</a></li>
<li><a href="#%E5%AD%97%E4%BD%93%E5%A3%81%E7%BA%B8">字体&amp;壁纸</a></li>
</ul>
</li>
<li><a href="#python%E7%9A%84%E5%AE%89%E8%A3%85%E5%8F%8A%E9%85%8D%E7%BD%AE">Python的安装及配置</a><ul>
<li><a href="#pip">pip</a></li>
<li><a href="#conda">Conda</a></li>
<li><a href="#setuptools">setuptools</a></li>
</ul>
</li>
<li><a href="#%E7%BB%88%E7%AB%AF%E5%B7%A5%E5%85%B7%E9%85%8D%E7%BD%AE">终端工具配置</a><ul>
<li><a href="#vimneovim%E9%85%8D%E7%BD%AE">vim/neovim配置</a></li>
<li><a href="#zsh%E9%85%8D%E7%BD%AE">zsh配置</a></li>
<li><a href="#ranger%E9%85%8D%E7%BD%AE">ranger配置</a></li>
</ul>
</li>
<li><a href="#st--dwm">st &amp; dwm</a></li>
<li><a href="#%E7%BE%8E%E5%8C%96">美化</a><ul>
<li><a href="#gnome%E7%BE%8E%E5%8C%96">Gnome美化</a></li>
<li><a href="#kde-plasma%E7%BE%8E%E5%8C%96">KDE Plasma美化</a></li>
</ul>
</li>
<li><a href="#linux%E5%BF%85%E5%AE%89%E8%A3%85%E7%9A%84%E4%BE%9D%E8%B5%96%E4%BB%A5%E5%8F%8A%E5%BA%94%E7%94%A8">Linux必安装的依赖以及应用</a></li>
</ul>
<h2 id="基本配置"><a href="#基本配置" class="headerlink" title="基本配置"></a>基本配置</h2><h3 id="软件源配置"><a href="#软件源配置" class="headerlink" title="软件源配置"></a>软件源配置</h3><p>切换到中国源(Manjaro)</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman-mirrors -c China</span><br></pre></td></tr></table></figure>

<p>在 /etc/pacman.conf文件末尾添加以下内容：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[archlinuxcn]</span><br><span class="line">SigLevel = Never</span><br><span class="line">Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/<span class="variable">$arch</span></span><br></pre></td></tr></table></figure>
<p>运行</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -Syu</span><br></pre></td></tr></table></figure>
<h3 id="安装输入法"><a href="#安装输入法" class="headerlink" title="安装输入法"></a>安装输入法</h3><h4 id="fcitx"><a href="#fcitx" class="headerlink" title="fcitx"></a>fcitx</h4><p>安装fcitx框架及输入法：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -S fcitx-im</span><br><span class="line">sudo pacman -S fcitx-configtool</span><br><span class="line">sudo pacman -S fcitx-googlepinyin</span><br><span class="line">sudo pacman -S fcitx-rime</span><br><span class="line">sudo pacman -S rime-double-pinyin</span><br><span class="line">sudo pacman -S kcm-fcitx <span class="comment"># KDE Config Module for Fcitx</span></span><br></pre></td></tr></table></figure>
<p>然后将<code>default.custom.yaml</code>文件复制到<code>~/.config/fcitx/rime/</code>目录下。</p>
<p>在家目录下创建文件<code>.xprofile</code>，写入以下内容：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">export</span> LANG=zh_CN.UTF-8</span><br><span class="line"><span class="built_in">export</span> LC_ALL=zh_CN.UTF-8</span><br><span class="line"><span class="built_in">export</span> GTK_IM_MODULE=fcitx</span><br><span class="line"><span class="built_in">export</span> QT_IM_MODULE=fcitx</span><br><span class="line"><span class="built_in">export</span> XMODIFIERS=<span class="string">&quot;@im=fcitx&quot;</span></span><br></pre></td></tr></table></figure>

<h4 id="ibus-gnome桌面"><a href="#ibus-gnome桌面" class="headerlink" title="ibus(gnome桌面)"></a>ibus(gnome桌面)</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -S ibus-fime</span><br><span class="line">sudo pacman -S ibus-pinyin</span><br></pre></td></tr></table></figure>

<p>在家目录下创建文件.xprofile，写入以下内容：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">export</span> LANG=zh_CN.UTF-8</span><br><span class="line"><span class="built_in">export</span> LC_ALL=zh_CN.UTF-8</span><br><span class="line"><span class="built_in">export</span> GTK_IM_MODULE=ibus</span><br><span class="line"><span class="built_in">export</span> QT_IM_MODULE=ibus</span><br><span class="line"><span class="built_in">export</span> XMODIFIERS=<span class="string">&quot;@im=ibus&quot;</span></span><br></pre></td></tr></table></figure>

<h3 id="配置文件"><a href="#配置文件" class="headerlink" title="配置文件"></a>配置文件</h3><p>克隆配置文件到Github文件夹：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cp -r ~/Github/config/home_files/.* ~</span><br><span class="line">cp -r ~/Github/config/config_files/* ~/.config</span><br></pre></td></tr></table></figure>

<h3 id="NVIDIA显卡配置"><a href="#NVIDIA显卡配置" class="headerlink" title="NVIDIA显卡配置"></a>NVIDIA显卡配置</h3><p>首先安装驱动程序：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -S nvidia </span><br></pre></td></tr></table></figure>
<p>hoquxmkaPCI地址：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">lspci | grep -E <span class="string">&quot;VGA|3D&quot;</span></span><br><span class="line"><span class="comment"># 例输出如下</span></span><br><span class="line">00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)</span><br><span class="line">01:00.0 3D controller: NVIDIA Corporation GM107 [GeForce 940MX] (rev a2)</span><br></pre></td></tr></table></figure>
<p>转换示例：将第二行的01:00.0转换为1:0:0<br>打开/etc/X11/xorg.conf（如果没有就新建一个），输入：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">Section <span class="string">&quot;Module&quot;</span></span><br><span class="line">    Load <span class="string">&quot;modesetting&quot;</span></span><br><span class="line">EndSection</span><br><span class="line"></span><br><span class="line">Section <span class="string">&quot;Device&quot;</span></span><br><span class="line">    Identifier  <span class="string">&quot;nvidia&quot;</span></span><br><span class="line">    Driver      <span class="string">&quot;nvidia&quot;</span></span><br><span class="line">    BusID       <span class="string">&quot;1:0:0&quot;</span></span><br><span class="line">    Option      <span class="string">&quot;AllowEmptyInitialConfiguration&quot;</span></span><br><span class="line">EndSection</span><br></pre></td></tr></table></figure>

<p>配置/usr/share/sddm/scripts/Xsetup文件，追加：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">xrandr --setprovideroutputsource modesetting NVIDIA-0</span><br><span class="line">xrandr --auto</span><br></pre></td></tr></table></figure>

<h3 id="字体-amp-壁纸"><a href="#字体-amp-壁纸" class="headerlink" title="字体&amp;壁纸"></a>字体&amp;壁纸</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 中文字体</span></span><br><span class="line">sudo pacman -S wqy-microhei wqy-microhei-lite wqy-bitmapfont wqy-zenhei ttf-arphic-ukai ttf-arphic-uming adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts noto-fonts-cjk</span><br><span class="line"></span><br><span class="line">git <span class="built_in">clone</span> https://gitee.com/foryoungyu/fonts.git ~/.<span class="built_in">local</span>/share/fonts</span><br><span class="line"></span><br><span class="line"><span class="comment"># wallpapers</span></span><br><span class="line">git <span class="built_in">clone</span> https://gitee.com/foryoungyu/wallpaper.git ~/Pictures/wallpapers</span><br></pre></td></tr></table></figure>

<h2 id="Python的安装及配置"><a href="#Python的安装及配置" class="headerlink" title="Python的安装及配置"></a>Python的安装及配置</h2><h3 id="pip"><a href="#pip" class="headerlink" title="pip"></a>pip</h3><blockquote>
<p>可以安装 Python 软件包的 PyPA 工具。 </p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 从文件安装</span></span><br><span class="line">wget https://bootstrap.pypa.io/get-pip.py </span><br><span class="line"><span class="comment"># or</span></span><br><span class="line">curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py</span><br><span class="line">python3 get-pip.py </span><br><span class="line"></span><br><span class="line"><span class="comment"># Ubuntu</span></span><br><span class="line">sudo apt install python3-pip </span><br><span class="line"></span><br><span class="line"><span class="comment"># Arch</span></span><br><span class="line">sudo pacman -S python-pip</span><br><span class="line"></span><br><span class="line"><span class="comment">#查看pip版本</span></span><br><span class="line">pip -V　　</span><br></pre></td></tr></table></figure>

<p>添加pip源：复制.pip/文件夹到家目录。</p>
<h3 id="Conda"><a href="#Conda" class="headerlink" title="Conda"></a>Conda</h3><p><a target="_blank" rel="noopener" href="https://www.anaconda.com/">Anaconda官网</a><br><a target="_blank" rel="noopener" href="https://www.anaconda.com/products/individual#Downloads">Anaconda下载地址</a><br><a target="_blank" rel="noopener" href="https://docs.conda.io/en/latest/miniconda.html">Miniconda下载地址</a>  </p>
<p>或运行：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh</span><br><span class="line"></span><br><span class="line">bash Miniconda3-latest-Linux-x86_64.sh</span><br></pre></td></tr></table></figure>
<p>添加conda源，将.condarc文件复制到用户目录下。</p>
<h3 id="setuptools"><a href="#setuptools" class="headerlink" title="setuptools"></a>setuptools</h3><blockquote>
<p>可以简化 Python 软件包的下载、编译、安装、升级和卸载。  </p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -S python-setuptools <span class="comment"># arch</span></span><br></pre></td></tr></table></figure>

<h2 id="终端工具配置"><a href="#终端工具配置" class="headerlink" title="终端工具配置"></a>终端工具配置</h2><h3 id="vim-neovim配置"><a href="#vim-neovim配置" class="headerlink" title="vim/neovim配置"></a>vim/neovim配置</h3><p>复制config/nvim到～/.config目录下<br>vim-plug安装</p>
<blockquote>
<p>在安装vim-plug之前确保python以及相关库已经安装<br><a href="#Python%E7%9A%84%E5%AE%89%E8%A3%85%E5%8F%8A%E9%85%8D%E7%BD%AE">Jump to Python的安装及配置</a>  </p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># vim</span></span><br><span class="line">curl -fLo ~/.vim/<span class="built_in">autoload</span>/plug.vim --create-dirs \</span><br><span class="line">    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim</span><br><span class="line"></span><br><span class="line"><span class="comment"># neovim</span></span><br><span class="line">curl -fLo ~/.<span class="built_in">local</span>/share/nvim/site/<span class="built_in">autoload</span>/plug.vim --create-dirs \</span><br><span class="line">    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim</span><br><span class="line"></span><br><span class="line"><span class="comment"># 如果拒绝连接，打开该文件</span></span><br><span class="line">sudo vim /etc/hosts</span><br><span class="line"><span class="comment"># 添加</span></span><br><span class="line">199.232.28.133 raw.githubusercontent.com</span><br><span class="line"><span class="comment"># 安装插件的依赖库</span></span><br><span class="line">pip3 install pynvim --upgrade </span><br><span class="line"><span class="comment"># 最后打开neovim执行命令</span></span><br><span class="line">:PlugInstall</span><br><span class="line"><span class="comment"># 如果打开.py文件报错，执行</span></span><br><span class="line">:UpdateRemotePlugins</span><br></pre></td></tr></table></figure>

<h3 id="zsh配置"><a href="#zsh配置" class="headerlink" title="zsh配置"></a>zsh配置</h3><p>安装zsh</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo pacmen -S zsh <span class="comment"># arch</span></span><br><span class="line">sudo apt install zsh <span class="comment"># ubuntu</span></span><br></pre></td></tr></table></figure>
<p>修改默认bash为zsh</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chsh -s /usr/bin/zsh</span><br></pre></td></tr></table></figure>

<p>安装oh-my-zsh</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">curl -Lo install.sh https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh</span><br><span class="line">sh install.sh</span><br><span class="line"></span><br><span class="line"><span class="comment"># gitee</span></span><br><span class="line">sh -c <span class="string">&quot;<span class="subst">$(curl -fsSL https://gitee.com/shmhlsy/oh-my-zsh-install.sh/raw/master/install.sh)</span>&quot;</span></span><br><span class="line"><span class="comment"># or</span></span><br><span class="line">sh -c <span class="string">&quot;<span class="subst">$(wget -O- https://gitee.com/shmhlsy/oh-my-zsh-install.sh/raw/master/install.sh)</span>&quot;</span></span><br></pre></td></tr></table></figure>

<p><a target="_blank" rel="noopener" href="https://github.com/ohmyzsh/ohmyzsh/wiki/Themes">oh-my-zsh皮肤</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># typewritten</span></span><br><span class="line">git <span class="built_in">clone</span> https://github.com/reobin/typewritten.git <span class="variable">$ZSH_CUSTOM</span>/themes/typewritten</span><br><span class="line"></span><br><span class="line">ln -s <span class="string">&quot;<span class="variable">$ZSH_CUSTOM</span>/themes/typewritten/typewritten.zsh-theme&quot;</span> <span class="string">&quot;<span class="variable">$ZSH_CUSTOM</span>/themes/typewritten.zsh-theme&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># powerlever10k</span></span><br><span class="line">git <span class="built_in">clone</span> --depth=1 https://github.com/romkatv/powerlevel10k.git <span class="variable">$&#123;ZSH_CUSTOM:-~/.oh-my-zsh/custom&#125;</span>/themes/powerlevel10k</span><br><span class="line"></span><br><span class="line"><span class="comment"># 配置powerlever10k</span></span><br><span class="line">p10k configure</span><br></pre></td></tr></table></figure>
<p>oh-my-zsh插件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># zsh-autosuggestions</span></span><br><span class="line">git <span class="built_in">clone</span> https://github.com/zsh-users/zsh-autosuggestions <span class="variable">$&#123;ZSH_CUSTOM:-~/.oh-my-zsh/custom&#125;</span>/plugins/zsh-autosuggestions</span><br><span class="line"></span><br><span class="line"><span class="comment"># zsh-syntax-highlighting</span></span><br><span class="line">git <span class="built_in">clone</span> https://github.com/zsh-users/zsh-syntax-highlighting.git <span class="variable">$&#123;ZSH_CUSTOM:-~/.oh-my-zsh/custom&#125;</span>/plugins/zsh-syntax-highlighting</span><br><span class="line"></span><br><span class="line"><span class="comment"># autojump</span></span><br><span class="line">git <span class="built_in">clone</span> git://github.com/wting/autojump.git ~/Github/autojump</span><br><span class="line"><span class="built_in">cd</span> ~/Github/autojump</span><br><span class="line">./install.py</span><br></pre></td></tr></table></figure>
<h3 id="ranger配置"><a href="#ranger配置" class="headerlink" title="ranger配置"></a>ranger配置</h3><p>包括的插件和命令有：</p>
<ul>
<li>ranger-devicons</li>
<li>:extracter <paths></li>
<li>:extracterhere</li>
<li>:compress</li>
</ul>
<p>复制ranger目录到～/.config/目录下</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 生成ranger配置文件命令</span></span><br><span class="line">ranger --copy-config=all</span><br><span class="line"></span><br><span class="line"><span class="comment"># 修改默认编辑器命令</span></span><br><span class="line">select-editor <span class="comment"># Ubuntu</span></span><br></pre></td></tr></table></figure>
<h2 id="st-amp-dwm"><a href="#st-amp-dwm" class="headerlink" title="st &amp; dwm"></a>st &amp; dwm</h2><p><a target="_blank" rel="noopener" href="https://suckless.org/">suckless官网</a></p>
<p>分别进入两个目录下，输入以下命令：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">make</span><br><span class="line">sudo make clean install</span><br></pre></td></tr></table></figure>

<p>其中，dwm需复制dwm.desktop文件到/usr/share/xsessions目录下，并将.screpts目录复制到家目录中。</p>
<h2 id="美化"><a href="#美化" class="headerlink" title="美化"></a>美化</h2><h3 id="Gnome美化"><a href="#Gnome美化" class="headerlink" title="Gnome美化"></a>Gnome美化</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -S gnome-tweak-tool <span class="comment"># gnome美化面板</span></span><br><span class="line">sudo pacman -S chrome-gnome-shell <span class="comment"># 用chromium配置gnome的工具</span></span><br></pre></td></tr></table></figure>

<h3 id="KDE-Plasma美化"><a href="#KDE-Plasma美化" class="headerlink" title="KDE Plasma美化"></a>KDE Plasma美化</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -S latte-dock <span class="comment"># kde dock</span></span><br><span class="line">yay -S compiz </span><br></pre></td></tr></table></figure>
<p>之后在终端运行<code>latte-dock</code></p>
<h2 id="Linux必安装的依赖以及应用"><a href="#Linux必安装的依赖以及应用" class="headerlink" title="Linux必安装的依赖以及应用"></a>Linux必安装的依赖以及应用</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># ===================基础依赖===========================</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 设备驱动</span></span><br><span class="line">sudo pacman -S net-tools</span><br><span class="line">sudo pacman -S xorg xorg-server</span><br><span class="line">sudo pacman -S xf86-input-synaptics <span class="comment"># 触摸板驱动</span></span><br><span class="line">sudo pacman -S xf86-input-libinput</span><br><span class="line">sudo pacman -S xf86-video-intel <span class="comment"># intel显卡驱动</span></span><br><span class="line">sudo pacman -S xf86-video-ati <span class="comment"># amd显卡驱动</span></span><br><span class="line">sudo pacman -S alsa-utils pulseaudio pulseaudio-alsa <span class="comment"># 声音管理器</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 底层应用</span></span><br><span class="line">sudo pacman -S w3m <span class="comment"># 终端浏览器</span></span><br><span class="line">sudo pacman -S ntfs-3g <span class="comment"># 识别windows分区</span></span><br><span class="line">sudo pacman -S make cmake <span class="comment"># 编译工具</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># ======================应用程序==========================</span></span><br><span class="line"><span class="comment"># Arch / Manjaro</span></span><br><span class="line">sudo pacman -S zsh</span><br><span class="line">sudo pacman -S fish</span><br><span class="line">sudo pacman -S git</span><br><span class="line">sudo pacman -S yay <span class="comment"># Arch的AUR</span></span><br><span class="line">sudo pacman -S alacritty</span><br><span class="line">sudo pacman -S htop</span><br><span class="line">sudo pacman -S ranger</span><br><span class="line">sudo pacman -S i3</span><br><span class="line">sudo pacman -S polybar</span><br><span class="line"></span><br><span class="line">sudo pacman -S code <span class="comment"># vscode</span></span><br><span class="line">sudo pacman -S netease-cloud-music <span class="comment"># 网易云音乐</span></span><br><span class="line">sudo pacman -S kdenlive <span class="comment"># 视频剪辑软件</span></span><br><span class="line">sudo pacman -S gimp <span class="comment"># 修图软件</span></span><br><span class="line">sudo pacman -S simplescreenrecorder <span class="comment"># 录屏软件</span></span><br><span class="line">sudo pacman -S libreoffice-fresh-zh-cn <span class="comment"># 中文版libreoffice</span></span><br><span class="line">yay -S dropbox</span><br><span class="line"></span><br><span class="line"><span class="comment"># Wechat</span></span><br><span class="line">yay -S deepin-wine-wechat</span><br><span class="line">yay -S deepin.com.wechat2</span><br><span class="line">sudo pacman -S electronic-wechat-git</span><br><span class="line">sudo pacman -S electron-wechat</span><br><span class="line">yay -S wechat-devtools</span><br><span class="line"></span><br><span class="line"><span class="comment"># QQ &amp; TIM</span></span><br><span class="line">yay -S deepin-wine-tim</span><br><span class="line">yay -S deepin-wine-qq</span><br></pre></td></tr></table></figure>
      
    </div>

    
    
    

    <footer class="post-footer">
        <div class="post-eof"></div>
      
    </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://foryoungyu.gitee.io/2020/06/11/hello-world/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/dog.jpg">
      <meta itemprop="name" content="Foryoung Yu">
      <meta itemprop="description" content="欣欣向荣">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Salt.'s Blog">
    </span>

    
    
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2020/06/11/hello-world/" class="post-title-link" itemprop="url">Hello World</a>
        </h2>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2020-06-11 00:00:00" itemprop="dateCreated datePublished" datetime="2020-06-11T00:00:00+08:00">2020-06-11</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-13 22:18:58" itemprop="dateModified" datetime="2021-02-13T22:18:58+08:00">2021-02-13</time>
      </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
          <p>Welcome to <a target="_blank" rel="noopener" href="https://hexo.io/">Hexo</a>! This is your very first post. Check <a target="_blank" rel="noopener" href="https://hexo.io/docs/">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a target="_blank" rel="noopener" href="https://hexo.io/docs/troubleshooting.html">troubleshooting</a> or you can ask me on <a target="_blank" rel="noopener" href="https://github.com/hexojs/hexo/issues">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">&quot;My New Post&quot;</span></span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/writing.html">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/server.html">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/generating.html">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>

<p>More info: <a target="_blank" rel="noopener" href="https://hexo.io/docs/one-command-deployment.html">Deployment</a></p>

      
    </div>

    
    
    

    <footer class="post-footer">
        <div class="post-eof"></div>
      
    </footer>
  </article>
  
  
  


  



      

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      const commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

    </div>
  </main>

  <footer class="footer">
    <div class="footer-inner">
      

      

<div class="copyright">
  
  &copy; 2020 – 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Foryoung Yu</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="//cdn.jsdelivr.net/npm/animejs@3.2.0/lib/anime.min.js"></script>
<script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script>

  


















  








  

  

</body>
</html>
